<template>
  <div class="profile-card">
    <div class="profile-info">
      <div class="profile-avatar">
        <img :src="user.avatar" alt="头像">
      </div>
      <div class="profile-details">
        <div class="profile-name">{{ user.name }}</div>
        <div class="profile-position">{{ user.position }}</div>
        <div class="profile-department">{{ user.department }}</div>
      </div>
    </div>
    <div class="profile-stats">
      <div class="stat-item">
        <div class="stat-value">{{ stats.todo }}</div>
        <div class="stat-label">待办</div>
      </div>
      <div class="stat-item">
        <div class="stat-value">{{ stats.assets }}</div>
        <div class="stat-label">资产</div>
      </div>
      <div class="stat-item">
        <div class="stat-value">{{ stats.requests }}</div>
        <div class="stat-label">申请</div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'ProfileCard',
  computed: {
    ...mapState(['user', 'stats'])
  }
}
</script>

<style scoped>
.profile-card {
  background: linear-gradient(135deg, #1890ff, #096dd9);
  border-radius: 12px;
  padding: 16px;
  margin: 16px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-info {
  display: flex;
  align-items: center;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  overflow: hidden;
  background-color: #fff;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-details {
  margin-left: 12px;
  flex: 1;
}

.profile-name {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 4px;
}

.profile-position {
  font-size: 14px;
  opacity: 0.9;
}

.profile-department {
  font-size: 12px;
  opacity: 0.8;
}

.profile-stats {
  display: flex;
  margin-top: 12px;
  justify-content: space-between;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  flex: 1;
  margin: 0 4px;
}

.stat-value {
  font-size: 16px;
  font-weight: 500;
}

.stat-label {
  font-size: 12px;
  opacity: 0.9;
}
</style> 